﻿using NUnit.Framework;
using Rhino.Mocks;

namespace Framework.Testing
{
    public class MockedTestData : TestDataBase
    {
        private MockRepository _mocks;
        private bool _isReplay;

        public MockRepository Mocks { get { return _mocks; } }

        public void ReplayAll()
        {
            _mocks.ReplayAll();
            _isReplay = true;
        }

        public MockedTestData()
        {
            _mocks = new MockRepository();
        }

        public T Mock<T>() where T : class
        {
            return Mocks.DynamicMock<T>();
        }

        public T Stub<T>() where T : class
        {
            return Mocks.Stub<T>();
        }

        public void VerifyAll()
        {
            if (_isReplay) _mocks.VerifyAll();
            _isReplay = false;
        }
    }

    public abstract class MockedTestFixture<TData> : TestFixtureBase<TData> where TData : MockedTestData
    {
        [SetUp]  
        public void Setup()
        {
        }

    }
}
